package com.oritsh.dicom.service;

import com.pixelmed.dicom.DicomException;
import com.pixelmed.dicom.UIDGenerator;

/**
 * Created with IntelliJ IDEA.
 * User: zarra
 * Date: 14-3-19
 * Time: 下午6:35
 * Copyright Shanghai Orient Rain Information Technology Co.,Ltd.
 */
public class InstanceUIDSrvPixelmedImpl implements  InstanceUIDService {
    private UIDGenerator uidGenerator;
    public InstanceUIDSrvPixelmedImpl(){
        uidGenerator = new UIDGenerator();
    }

    @Override
    public String generateStudyInstanceUID() {
        try {
            return uidGenerator.getNewUID();
        } catch (DicomException e) {
            return null;
        }
    }

    @Override
    public String generateSeriesInstanceUID(String studyUID, String seriesNumber) {
        try {
            return uidGenerator.getNewSeriesInstanceUID(studyUID,seriesNumber);
        } catch (DicomException e) {
            return null;
        }
    }

    @Override
    public String generateSOPInstanceUID(String studyUID, String seriesNumber, String instanceNumber) {
        try {
            return uidGenerator.getNewSOPInstanceUID(studyUID,seriesNumber,instanceNumber);
        } catch (DicomException e) {
            return null;
        }
    }
}
